package command

import (
	uuid "github.com/satori/go.uuid"
	"ssadmin/internal/admin/models"
)

type SysDictDataInsertReq struct {
	Id        string `json:"-" comment:""`
	DictSort  int    `json:"dictSort" comment:""`
	DictLabel string `json:"dictLabel" comment:""`
	DictValue string `json:"dictValue" comment:""`
	DictType  string `json:"dictType" comment:""`
	CssClass  string `json:"cssClass" comment:""`
	ListClass string `json:"listClass" comment:""`
	IsDefault string `json:"isDefault" comment:""`
	Status    int    `json:"status" comment:""`
	Default   string `json:"default" comment:""`
	Remark    string `json:"remark" comment:""`
	SystemId  string `json:"systemId"`
	ControlBy
}

func (s *SysDictDataInsertReq) Generate(model *models.SysDictData) {
	s.Id = uuid.NewV4().String()
	model.DictCode = s.Id
	model.DictSort = s.DictSort
	model.DictLabel = s.DictLabel
	model.DictValue = s.DictValue
	model.DictType = s.DictType
	model.CssClass = s.CssClass
	model.ListClass = s.ListClass
	model.IsDefault = s.IsDefault
	model.Status = s.Status
	model.Default = s.Default
	model.Remark = s.Remark
	model.SystemId = s.SystemId
}

func (s *SysDictDataInsertReq) GetId() interface{} {
	return s.Id
}

type SysDictDataUpdateReq struct {
	Id        string `json:"dictCode" comment:""`
	DictSort  int    `json:"dictSort" comment:""`
	DictLabel string `json:"dictLabel" comment:""`
	DictValue string `json:"dictValue" comment:""`
	DictType  string `json:"dictType" comment:""`
	CssClass  string `json:"cssClass" comment:""`
	ListClass string `json:"listClass" comment:""`
	IsDefault string `json:"isDefault" comment:""`
	Status    int    `json:"status" comment:""`
	Default   string `json:"default" comment:""`
	Remark    string `json:"remark" comment:""`
	SystemId  string `json:"systemId"`
	ControlBy
}

func (s *SysDictDataUpdateReq) Generate(model *models.SysDictData) {
	model.DictCode = s.Id
	model.DictSort = s.DictSort
	model.DictLabel = s.DictLabel
	model.DictValue = s.DictValue
	model.DictType = s.DictType
	model.CssClass = s.CssClass
	model.ListClass = s.ListClass
	model.IsDefault = s.IsDefault
	model.Status = s.Status
	model.Default = s.Default
	model.Remark = s.Remark
	model.SystemId = s.SystemId
}

func (s *SysDictDataUpdateReq) GetId() interface{} {
	return s.Id
}

type SysDictDataDeleteReq struct {
	Ids       []string `json:"ids"`
	ControlBy `json:"-"`
}

func (s *SysDictDataDeleteReq) GetId() interface{} {
	return s.Ids
}

// SetCreateBy 设置创建人id
func (e *ControlBy) SetCreateBy(createBy string) {
	e.CreateBy = createBy
}

// SetUpdateBy 设置修改人id
func (e *ControlBy) SetUpdateBy(updateBy string) {
	e.UpdateBy = updateBy
}
